#include "searchresultgui.h"
#include "dcpp/SearchResult.h"

using namespace dcpp;

SearchResultGUI::SearchResultGUI(SearchResult *searchResult, QObject *parent) :
    QObject(parent),
    m_searchResult(searchResult)
{}

const QString &SearchResultGUI::fileName() const{
    return m_searchResult->getFileName().c_str();
}

const QString &SearchResultGUI::slotString() const{
    return m_searchResult->getSlotString().c_str();
}

const QString &SearchResultGUI::file() const{
    return m_searchResult->getFile().c_str();
}

const QString &SearchResultGUI::hubURL() const{
    return m_searchResult->getHubURL().c_str();
}

const QString &SearchResultGUI::hubName() const{
    return m_searchResult->getHubName().c_str();
}

qint64 SearchResultGUI::size() const{
    return m_searchResult->getSize();
}

const QString &SearchResultGUI::type() const{
    if(m_searchResult->getType() == SearchResult::TYPE_FILE)
        return trUtf8("Файл");
    else if(m_searchResult->getType() == SearchResult::TYPE_DIRECTORY)
        return trUtf8("Каталог");
    else
        return trUtf8("Неизвестный тип");
}

int SearchResultGUI::slots_() const{
return m_searchResult->getSlots();
}

int SearchResultGUI::freeSlots() const{
return m_searchResult->getFreeSlots();
}

const QString &SearchResultGUI::TTH() const{
    return m_searchResult->getTTH().toBase32().c_str();
}

const QString &SearchResultGUI::IP() const{
    return m_searchResult->getIP().c_str();
}

const QString &SearchResultGUI::token() const{
    return m_searchResult->getToken().c_str();
}
